package com.hope.mychat.controller;

import com.hope.mychat.domain.vo.User;
import com.hope.mychat.service.FriendService;
import com.hope.mychat.service.UserService;
import com.hope.mychat.support.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotBlank;

/**
 * @author ZWH
 */
@RestController
@RequestMapping("/friend")
@Validated
public class FriendController {

    private UserService userService;
    private FriendService friendService;

    @Autowired
    FriendController(UserService userService, FriendService friendService) {
        this.userService = userService;
        this.friendService = friendService;
    }

    /**
     * 搜索用户
     * @return
     */
    @PostMapping("/search")
    public Response getUser() {
        return Response.success().addData(new User());
    }

    /**
     * 添加好友
     * @return
     */
    @PostMapping("/add")
    public Response addFriend(@NotBlank String friendId) {
        friendService.addFriend(friendId);
        return Response.success();
    }

    /**
     * 移除好友
     * @return
     */
    @PostMapping("/remove")
    public Response removeFriend() {
        return Response.success();
    }
}
